package edu.hitsz.factory.enemyFactory;

import edu.hitsz.aircraft.enemy.AbstractEnemy;
import edu.hitsz.aircraft.enemy.BossEnemy;
import edu.hitsz.application.Game.Game;
import edu.hitsz.application.ImageManager;
import edu.hitsz.application.Main;

public class BossEnemyFactory extends EnemyFactory{
    public BossEnemyFactory() {
    }

    @Override
    public void setBaseValue() {
        this.baseHp=200;
        this.baseSpeedX=0;
        if(Math.random()<0.5){
            this.baseSpeedX=-2;
        }
        else {
            this.baseSpeedX=2;
        }
        this.baseSpeedY=6;
    }

    @Override
    public void setLevelValue() {

        if(Game.upBossHp) {
            int upHp = Game.bossCreatedTime * 100;
            this.hp = baseHp + upHp;
            System.out.println("boss血量：" + this.hp);
        }else {
            System.out.println("boss血量：" + this.hp);
        }

    }

    @Override
    public void setEasyMode() {
        hp=baseHp;
        speedX=baseSpeedX;
        speedY=baseSpeedY;
    }

    @Override
    public void setNormalMode() {
        hp= (int) (baseHp*1.5);
        speedX= (int) (baseSpeedX*1.2);
        speedY=baseSpeedY;
    }

    @Override
    public void setHardMode() {
        hp=baseHp*2;
        speedX= (int) (baseSpeedX*1.5);
        speedY=baseSpeedY;
    }

    @Override
    public AbstractEnemy createEnemy() {
        return new BossEnemy(
                (int) (Math.random() * (Main.WINDOW_WIDTH - ImageManager.BOSS_ENEMY_IMAGE.getWidth())),
                (int) (Math.random() * Main.WINDOW_HEIGHT * 0.05),
                speedX,
                speedY,
                hp
        );
    }
}
